package com.blb.ssh.service.impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.blb.ssh.dao.BaseDao;
import com.blb.ssh.service.BaseService;

@Service
public class BaseServiceImpl<T> implements BaseService<T> {
	
	@Autowired
	@Qualifier("baseDao")
	private BaseDao<T> dao;
	
	@Override
	public void save(T t) {
		dao.save(t);
	}

	@Override
	public void update(T t) {
		dao.update(t);
	}

	@Override
	public void delete(T t) {
		dao.delete(t);
	}

	@Override
	public T findById(Serializable id) {
		return dao.findById(id);
	}

	@Override
	public List<T> findByHQL(String hql, Object... params) {
		return dao.findByHQL(hql, params);
	}

	@Override
	public List<T> getList(int pageNo, int pageSize) {
		return dao.getList(pageNo, pageSize);
	}

	@Override
	public int getCount(int pageNo, int pageSize) {
		return dao.getCount(pageNo, pageSize);
	}

	@Override
	public void batchDelete(List<T> list) {
		for (T t : list) {
			dao.delete(t);
		}
	}

}
